package com.tgy.interceptor;

import java.lang.reflect.Method;


public class MethodInvocation implements Invocation {

  private Object bean;

  private Method invoke;

  private Object[] args;

  public MethodInvocation(Object bean, Method invoke, Object[] args) {
    this.bean = bean;
    this.invoke = invoke;
    this.args = args;
  }

  @Override
  public Object proceed() throws Throwable {

    return invoke.invoke(bean,args);
  }

  @Override
  public Object getThis() {
    return this.bean;
  }

  @Override
  public Method getMethod() {
    return this.invoke;
  }

  @Override
  public Object[] getArguments() {
    return args;
  }

}
